<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title></title>
  </head>
  <body>
    <div id="app">
      <span>仅做加法</span>
      <br>
      <input type="text" name="" id="" placeholder="请输入第1个数" v-model="num1">
      <br>
      <input type="text" name="" id="" placeholder="请输入第2个数" v-model="num2">
      <p>结果是：{{res}}</p>
      <button @click=sum>计算结果</button>
    </div>
    <script src="./vue.js"></script>
    <script>
      const vm=new Vue({
        el:'#app',
        data:{num1:"",num2:"",res:""},
        methods:{sum(){
          this.res=(+this.num1)+(+this.num2)
        }},
       })
    </script>
  </body>
</html>